//活动管理的api（工具类）
import request from '@/utils/request'
const group_name="gathering"
const api_name="gathering"

//导出对象
export default {
    //获取活动列表
    getList:function() {
        return request({
            url: `/${group_name}/${api_name}`,
            method: 'get'
        })
    },
    //根据条件查询活动列表
    search:function(searchMap) {
        return request({
            url: `/${group_name}/${api_name}/search`,
            method: 'post',
            data:searchMap
        })  
    },
    //活动分页列表（根据条件查询）
    searchPage:function(searchMap,page,size) {
        return request({
            url: `/${group_name}/${api_name}/search/${page}/${size}`,
            method: 'post',
            data:searchMap
        })  
    },
    //新增活动
    save:function(pojo) {
        return request({
            url: `/${group_name}/${api_name}`,
            method: 'post',
            data:pojo
        }) 
    },
    //根据id查询
    findById:function(id) {
        return request({
            url: `/${group_name}/${api_name}/${id}`,
            method: 'get'
        }) 
    },
    //根据id更新
    update:function(id,pojo) {
        return request({
            url: `/gathering/gathering/${id}`,
            method: 'put',
            data:pojo
        }) 
    },
    saveOrUpdate:function(id,pojo) {
        if(id == undefined || id == null || id ==''){
            return this.save(pojo)
        }else{
            return this.update(id,pojo)
        }
    },
    deleteById:function(id) {
        return request({
            url: `/gathering/gathering/${id}`,
            method: 'delete'
        }) 
    }
}